package com.itkjb.leisurely.center.sys.model;

import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.io.Serializable;
import java.util.Collection;

/**
 * Copyright (C), 2018-2020
 *
 * @Author: lix
 * @Date: 2020-07-24 13:48
 * @Description: 用户登录详情信息
 * @Version: V1.0.0
 */
@Data
public class SysUserDetail  extends User implements Serializable {


    private static final long serialVersionUID = 2194030641632222206L;

    private Serializable userId;

    /**
     * Calls the more complex constructor with all boolean arguments set to {@code true}.
     */
    public SysUserDetail(String username, String password,
                   Collection<? extends GrantedAuthority> authorities) {
        super(username, password,authorities);
    }
    /**
     * Construct the <code>User</code> with the details required by
     * {@link org.springframework.security.authentication.dao.DaoAuthenticationProvider}.
     *`
     * @param username the username presented to the
     * <code>DaoAuthenticationProvider</code>
     * @param password the password that should be presented to the
     * <code>DaoAuthenticationProvider</code>
     * @param enabled set to <code>true</code> if the user is enabled
     * @param accountNonExpired set to <code>true</code> if the account has not expired
     * @param credentialsNonExpired set to <code>true</code> if the credentials have not
     * expired
     * @param accountNonLocked set to <code>true</code> if the account is not locked
     * @param authorities the authorities that should be granted to the caller if they
     * presented the correct username and password and the user is enabled. Not null.
     *
     * @throws IllegalArgumentException if a <code>null</code> value was passed either as
     * a parameter or as an element in the <code>GrantedAuthority</code> collection
     */
    public SysUserDetail(String username, String password, boolean enabled,
                   boolean accountNonExpired, boolean credentialsNonExpired,
                   boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities){
        super(username,password,enabled,accountNonExpired,credentialsNonExpired,accountNonLocked,authorities);
    }

    @Override
    public String toString() {
        return "SysUserDetail{" +
                "userId=" + this.userId +
                '}'+ super.toString();
    }
}
